<template>
  <div class="home">
    <h2>欢迎使用后台管理系统</h2>
    <p>当前用户：{{ authStore.userInfo?.username || '未登录' }}</p>
    <p>Token：{{ authStore.token ? '已设置' : '未设置' }}</p>
    <el-button @click="handleLogout" type="danger">退出登录</el-button>
  </div>
</template>

<script setup>
import { useAuthStore } from '@/stores/auth'
import { logout } from '@/api/auth'
import { useRouter } from 'vue-router'

const authStore = useAuthStore()
const router = useRouter()

const handleLogout = () => {
  logout()
  router.push('/login')
}
</script>

<style scoped>
.home {
  padding: 20px;
}
</style> 